#include "eth_FifoRecvData.h"

u32 eth_FifoRecvData(XLlFifo *FifoPtr, EthernetFrame *FramePtr)
{
    u32 FrameLength = 0;
    u32 timeout = 100;

    /* While there is data in the fifo ... */
    while (timeout)
    {
        if (XLlFifo_RxOccupancy(FifoPtr))
        {
            // Get the packet length
            FrameLength = XLlFifo_RxGetLen(FifoPtr);
            XLlFifo_Read(FifoPtr, FramePtr, FrameLength);
            break;
        }
        else
        {
            timeout--;
        }
    }
    return FrameLength;
}